<?php

use yii\helpers\Html;
use yii\helpers\ArrayHelper;
use yii\widgets\ActiveForm;
use common\models\FormVal;
use backend\models\App;
use backend\models\Supplier;

/* @var $this yii\web\View */
/* @var $model backend\models\App */
/* @var $form yii\widgets\ActiveForm */

$sellTypes = [App::SELL_TYPE_LINGSHOU=>'零售',  App::SELL_TYPE_HUNPI=>'混批',App::SELL_TYPE_ZHENGXIANG=>'整箱'];
$types=[App::TYPE_SUPPLIER=>'供应商商城',App::TYPE_LMD=>'乐麦地分站'];

?>

<div class="app-form">

    <?php $form = ActiveForm::begin(); ?>

    <?= $form->field($model, 'name')->textInput(['maxlength' => 45]) ?>
    <?= $form->field($model, 'sell_type')->radioList($sellTypes, ['separator' => FormVal::$separator10]); ?>
    <?= $form->field($model, 'type')->radioList($types, ['separator' => FormVal::$separator10]); ?>
    <?= $form->field($model, 'key')->textInput(['maxlength' => 45]) ?>
    <?= $form->field($model, 'gateway')->textInput(['maxlength' => 100]) ?>
    <?= $form->field($model, 'url')->textInput(['maxlength' => 100]) ?>

    <?= $form->field($model, 'supplier_id')->dropDownList(ArrayHelper::map(Supplier::find()->all(), 'id', 'name')) ?>
    <?= $form->field($model, 'category_filter')->textarea(['rows' => 6]) ?>

    

    <?= $form->field($model, 'enable')->radioList(FormVal::$bool, ['separator' => FormVal::$separator10]); ?>

    <div class="form-group">
        <?= Html::submitButton($model->isNewRecord ? '新建' : '更新', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?>
    </div>

    <?php ActiveForm::end(); ?>

</div>
